<?
session_start();
$userArray=$_SESSION['userArray'];
include ("usersystem/config/conf.php");
include ("usersystem/lib/mysqlClass.php");
include ("function/function.php");
include ("function/global.php");
include ("getCity.php");
define('PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);

$mysqlClass=new mysqlClass();

	function getdata($sql,$key)
	{
		global $mysqlClass;
		global $mediaTable;
		global $showCity;
		
		//$sql="select * from $mediaTable where  mtBig=$id and mtCheck=1 $where order by mtEdate desc limit 0, $limit";
		//echo $sql;
		$result=$mysqlClass->getRs($sql);
		$datalist=array();
		while($rs=$result->fetch_array(MYSQL_ASSOC))
		 {
			if($key) {
				$datalist[$rs[$key]] = $rs;
			} else {
				$datalist[] = $rs;
			}
		 }
		 //print_r($datalist);
		return $datalist;
	}
$data=getdata('select * from `areatable`','areaId');
$data = "<?php\nreturn ".var_export($data, true).";\n?>";
echo file_put_contents(PATH."data/area.php", $data,LOCK_EX);

$data=getdata('select * from `citytable`','citId');
$data = "<?php\nreturn ".var_export($data, true).";\n?>";
echo file_put_contents(PATH."data/city.php", $data,LOCK_EX);

$data=getdata('select * from `conttable`','conId');
$data = "<?php\nreturn ".var_export($data, true).";\n?>";
echo file_put_contents(PATH."data/shen.php", $data,LOCK_EX);
	
echo "ko";
?>